<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@ page import="com.pptree.service.*" %>
<%@ page import="com.pptree.service.impl.*" %>
<%@ page import="com.pptree.vo.*" %>
<%
	request.setCharacterEncoding("UTF-8");
	
	String name = request.getParameter("name");
	
	GenreService genreService = new GenreServiceImpl();
	
	Genre genre = new Genre();
	genre.setName(name);
	
	boolean result = genreService.addCategory(genre);
	
	if(result){
		
		String script = "<script>alert('保存新闻主题成功！');location.href='genreList.jsp';</script>";
		out.print(script);
		
		
		//response.sendRedirect("admin/genreList.jsp");
	}
	else{
		request.setAttribute("errMsg", "新闻主题己存在。");
		request.getRequestDispatcher("/admin/addGenre.jsp").forward(request, response);
	}
%>
